﻿<%template _header%>
<%namespace YouHP.Model%>
<%namespace YouHP.BLL%>
<%namespace YouHP.Utility%>
<%namespace YouHP.Model.Group%>

<div class="layout-cols2">

<script type="text/javascript">
    
function checkCheckBox(form,objtag)
{
	if (typeof(objtag.checked) == "undefined")
	{
	objtag.checked = true;
	}
	for(var i = 0; i < form.elements.length; i++) 
	{
		var e = form.elements[i];
		if(e.name == "itemid") 
		{
			e.checked = objtag.checked;
		}
	}
	objtag.checked = !objtag.checked;
}


</script>
	
<div class="pannelcontent_1">

	<div class="pcontent">
	   <div  class="panneldetail">
		<%template _memgroupmenu%>
			<div class="pannelbody">
			
                <%if IsPost%>
                <%template _msgbox%>
                <%else%>
		<div class="friendinvite"> 

            <%csharp%>TempUrl="/User/Group/InvitePatients.aspx?gid="+GroupData.Id;<%/csharp%>
           <p><b>1.邀请站内用户:</b><a href="{this.GetUrl(TempUrl)}" class="selectall">查找</a></p>
 
           <p><b>2.邀请你的好友加入该圈:</b></p>
               
                 
          <table  border="0" cellpadding="0" cellspacing="0" class="plist">
	      <tr align="center" style="height:30px;"> 
            <td width="10%" height="26" align="center"><b class="tdtitle">头像</b></td>

            <td width="20%"><b class="tdtitle">疾病</b></td>
            <td width="20%"><b class="tdtitle">性别/年龄/地区</b></td>
             <td width="30%"><b class="tdtitle"> 个人简介</b></td>
            <td>&nbsp;</td>
           
            </tr>
				<%csharp%>
				string str="tr_bgcolor_0";
				foreach(UserInfo item in FriendList) { 
				
				<%/csharp%>
					<tbody><tr height="60" class="{str}">
					<%csharp%>TempUrl = "/Profile/Index.aspx?uid=" + item.Id; <%/csharp%>
						<td  align="center" style="padding:5px;">
						    <a href="{this.GetUrl(TempUrl)}" class="user_img"><img src="{item.Avatar}" height="48" width="48"></img><br />
						    {item.UserName}</a></td>
						
						<td  align="center">
							<%csharp%>
							PatientRecordInfo dinfo = PatientBLL.Instance.GetPatientRecordInfo(item.Id);
							TempUrl = "/Disease.aspx?id=" + dinfo.DiseaseId;
							
							 <%/csharp%>
							<%if dinfo.DiseaseId>0%>
							<a href="{this.GetUrl(TempUrl)}">{DiseaseBLL.Instance.GetDiseaseInfo(dinfo.DiseaseId).Name}</a>
							<%else%>
							未知
							<%/if%>
						</td>
						<td  align="center" valign="middle">
						  {item.Gender}/<%if item.Age>0&&item.Age<208%>{item.Age}<%else%>未知<%/if%>/

						    <%if item.Province!=""||item.City!=""%>{item.Province}&nbsp;{item.City}<%else%>未知<%/if%>
						  </td>  
						  
						  <%csharp%>
						string sb=item.Description; 
						if(sb.Length==0){sb="暂无个人简介";}
						if(sb.Length>50){
						sb=sb.Substring(0,Math.Min(50,sb.Length))+"……";}
						<%/csharp%>
						
						<td valign="middle" style="padding-left:15px;"><span style="text-overflow:ellipsis; margin:5px;">{sb}</span></td>
						<%csharp%>
						int role = GroupUserBLL.Instance.GetGroupUserInfo(GroupData.Id,item.Id).Role;
						if(role == Constants.RoleAdmin || role == Constants.RoleCreator || role == Constants.RoleMember || role == Constants.RoleBlacklist || role == Constants.RoleInviting)
						{
						<%/csharp%>
						<td align="center"><font style="font-weight:bold;">已邀请</font></td>
						<%csharp%>}else{<%/csharp%>
						<td align=center id="invite{item.Id}"><a href="javascript:SendInvitation({GroupData.Id},{item.Id});" class="yellowbutton" id="sendbutton{item.Id}">发送邀请</a></td>
                        <%csharp%>}<%/csharp%>
					</tr></tbody>
					<%csharp%>
					if(str=="tr_bgcolor_0") str="tr_bgcolor_1";
					else str="tr_bgcolor_0";
					
					
					}<%/csharp%>
				</table>
		<div class="box">
			<div class="content">
				<div class="pages">
					{PagingString}
				</div>
			</div>
        </div>
        
<script type="text/javascript">
function SendInvitation(gid,uid)
{
   
   var aurl = "/Pages/alpha/User/Group/InvitePatientsAjax.aspx?gid="+gid+"&toUserId="+uid;

  _$("sendbutton"+uid).innerText="正在处理...";
  var myAjax=new Ajax(aurl,
  {
     method:'get',
     onComplete:function()
     {
      var flag=this.response.text;
      switch(flag)
      {
        case"0":
        _$("invite"+uid).innerHTML="<font style=\"font-weight:bold;\">发送成功！</font>";
        break;
        case"1":
        alert("该用户已经是圈子成员！");
        _$("sendbutton"+uid).innerText="已是成员";
        break;
        case"2":
        alert("已向该用户发送过邀请，不能重复发送！");
        _$("sendbutton"+uid).innerText="已邀请";
        break;
        case"3":
        alert("发送失败！");
        break;
      }

     }
   }
   );
   myAjax.request();


}

</script>
                 
                
                
                    
<!--                <table><tr><td>
				    <a href="javascript:;" class="yellowbutton"  onclick="checkCheckBox(_$('dataform'),this)">全选/全不选</a>
				    </td><td>
				    <a href="javascript:_$('dataform').submit();" class="yellowbutton">发送邀请</a>
				    </td></tr>
                 </table>-->
		    <br />
		</div>
		       <%/if%>
	</div>
</div>
</div>	
	
	
</div>
	
</div>

<%template _footer%>		
